const { createStore } = Redux

/**
 * 创建action:
 * @returns 
 */
function increment() {
    return { type:"increment"}
}
function decrement() {
    return { type:"decrement"}
}
/**
 * 创建reducier,reducier是一个纯函数
 * @param {*} state 
 * @param {*} action 
 * @returns 
 */
function counter(state = 0,action) {
    switch (action.type) { //动作
        case "increment": return state + 1;break
        case "decrement": return state - 1;break
        case "except": return state * 10;break
        case "divide": return state / 10; break
        default: return state;
    }
}
/**
 * 创建store
 */
const store = createStore(counter)